package com.hwg.emp.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hwg.emp.service.AskoffService;
import com.hwg.emp.service.ServiceFactroy;

public class DeleteEmpAskoffController extends HttpServlet{
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		req.setCharacterEncoding("utf8");
		String sidsStr=req.getParameter("sids");
		String sids[]=sidsStr.split(",");
		AskoffService askoffService=ServiceFactroy.getService(AskoffService.class);
		try {
			boolean flag=askoffService.deleteEmpAskoff(sids);
			if(flag){
				req.getRequestDispatcher("/selectEmpAskoffs.do").forward(req, resp);
			}
			else {
				req.setAttribute("erro", "对不起，删除失败");
				req.getRequestDispatcher("/selectEmpAskoffs.do").forward(req, resp);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
